import 'package:learning/bean/learning_type_entity.dart';
import 'package:learning/generated/json/base/json_convert_content.dart';

LearningTypeEntity $LearningTypeEntityFromJson(Map<String, dynamic> json) {
  final LearningTypeEntity learningTypeEntity = LearningTypeEntity();
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    learningTypeEntity.icon = icon;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    learningTypeEntity.name = name;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    learningTypeEntity.id = id;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    learningTypeEntity.sort = sort;
  }
  return learningTypeEntity;
}

Map<String, dynamic> $LearningTypeEntityToJson(LearningTypeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['icon'] = entity.icon;
  data['name'] = entity.name;
  data['id'] = entity.id;
  data['sort'] = entity.sort;
  return data;
}

extension LearningTypeEntityExtension on LearningTypeEntity {
  LearningTypeEntity copyWith({
    String? icon,
    String? name,
    int? id,
    int? sort,
  }) {
    return LearningTypeEntity()
      ..icon = icon ?? this.icon
      ..name = name ?? this.name
      ..id = id ?? this.id
      ..sort = sort ?? this.sort;
  }
}